import React, { Component } from 'react'
import TabNavigator from 'react-native-tab-navigator'
import * as Device from 'expo-device';
import Home from '../Home/Home'
import Search from '../Search/Search'
import My from '../My/My'
import Header from '../../components/Header'
import { Actions } from 'react-native-router-flux';
const homes=require('../../assets/image/home.png')
const search=require('../../assets/image/search.png')
const my=require('../../assets/image/my.png')

import {
    Img
  } from './styled'
  import styles from './style'
interface Props {

}

interface State {
  selectedTab: string
}
export default class Index extends Component<Props, State> {
    constructor(props: Props) {
        super(props)
      }
    state: State = {
        selectedTab: 'home'
      }
      componentDidMount(){
        navigator.geolocation.getCurrentPosition(
          res => {
            // console.log(res)
          }, err => {
          }, {})
      }
    render() {
        return (
          <> 
          <Header></Header>
          <TabNavigator 
            tabBarStyle={Device.deviceName === 'iPhone Xʀ' ? styles.tabBarStyle : null}
            >
            <TabNavigator.Item 
            selected={this.state.selectedTab === 'home'}
            title="职位"
            renderIcon={() => <Img source={homes} />} 
            onPress={() => this.setState({ selectedTab: 'home' })}
            >
        
          <Home></Home>
           </TabNavigator.Item> 
           <TabNavigator.Item 
            selected={this.state.selectedTab === 'search'}
            title="搜索"
            renderIcon={() => <Img source={search} />} 
            onPress={() => this.setState({ selectedTab: 'search' })}
            >
            <Search></Search>

           </TabNavigator.Item> 

           <TabNavigator.Item 
            selected={this.state.selectedTab === 'my'}
            title="我的"
            renderIcon={() => <Img source={my} />} 
            onPress={() => this.setState({ selectedTab: 'my' })}
            >
           
                 <My></My>
           </TabNavigator.Item> 
            </TabNavigator> 
          </>
           
        )
    }
}
